import React from "react";
import {Button, Input, Select} from "antd";
import './parking-unit.scss'
import {BrowserRouter, Switch} from "react-router-dom";
import {renderRoutes} from "react-router-config";


function ParkingUnit(props){

    const gotoAdd = () => {
        window.location.href = '../parking_unit/add?menu=parking_unit'
    }

    const route = props.route


    return(
        <div className={'component_container'}>
            <div className={'component_title'}>
                停车单位管理
            </div>

            <div className={'parking-unit-panel'}>
                <div className={'add-unit-panel-item'}>
                    <div className={'parking-unit-panel-item-title'} style={{width: 40}}>
                        区域
                    </div>
                    <Select placeholder={'请选择区域'}>
                        <Select.Option>区域一</Select.Option>
                    </Select>
                </div>

                <div className={'parking-unit-panel-item'}>
                    <div className={'parking-unit-panel-item-title'} style={{width: 80}}>
                        单位名称
                    </div>
                    <Input placeholder={'请输入关键字'}/>
                </div>

                <div className={'parking-unit-panel-item'}>
                    <div className={'parking-unit-panel-item-title'}>
                        状态
                    </div>
                    <Select placeholder={'请选择状态'}>
                        <Select.Option>状态一</Select.Option>
                    </Select>
                </div>

                <Button type={'primary'} style={{marginRight: 20}}>查询</Button>
                <Button style={{marginRight: 20}}>重置</Button>
                <Button type={'primary'} onClick={gotoAdd}>新增单位</Button>

            </div>

            <div className={'parking-unit-router'}>
                <BrowserRouter>
                    <Switch>
                        {renderRoutes(route.children)}
                    </Switch>
                </BrowserRouter>
            </div>
        </div>
    )
}

export default ParkingUnit